<?php
/**
 * 
 * 
 * Copyright (C) 2013 ARONDEL Julien, SHESHIVARI Adelina, KOHLER Marty
 * 
 * This file is part of Mediathor.
 * 
 * Mediathor is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 2 of the
 * License, or (at your option) any later version.
 * 
 * Mediathor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * See the GNU General Public License for more details. You should have received a copy of the GNU
 * General Public License along with Mediathor. If not, see <http://www.gnu.org/licenses/>.
 * 
 * Authors: KOHLER Marty, ARONDEL Julien, SHESHIVARI Adelina
 */
require_once( "Imdbphp/imdbsearch.class.php" );
require_once( "Imdbphp/imdb.class.php" );

/**  Naviguer dans les fichiers vid?os
 *
 */
function VideoBrowse()
{
   echo BrwsGallerie( $_SESSION['Repertoire'] );
}

/** Lecture vid?o
 *Authors: SHESHIVARI Adelina
 */
function VideoPlay()
{
	echo '<video width="800" height="444" controls="controls">';
	echo '<source src="' . $_SESSION['FichierComplet'] . '" type="video/mp4" />';
	echo '</video>'; 
}

/** Donne les informations sur un film à l'aide de son nom
 *  @return = Titre du film, Année de sortie et synopsis
 *  Authors: KOHLER Marty et ARONDEL Julien 
 */
function VideoInfo()
{
	$name = $_SESSION['Fichier'];
	
	if ( $name != '' )
	{
		# Still here? Then we need to search for the movie: 
		$search = new imdbsearch();
		$search->setsearchname( $name );
		$results = $search->results ();
		$res = $results[0];
		$headname = "Movie";


		$movie = new imdb( $res->imdbid() );
		$Titre = '<p class="info"><span class="categorie"> Titre : </span>'. $movie->title().'</p>';
		$Annee = '<p class="info"><span class="categorie">Année : </span>'. $movie->year().'</p>';
		$Genre = '<p class="info"><span class="categorie">Genre : </span>'. $movie->genre().'</p>';
		$real = $movie->director();
		$Realisateur =  '<p class="info"><span class="categorie">Réalisateur : </span>' . $real[0]['name'].'</p>';
		$plot = $movie->plot();

		if (!empty($plot[0])){			
			$plot = '<p class="info"><span class="categorie">Synopsis :</span></p><p class="info">' . $plot[0].'</p>';
		}else{
			$plot = '<p class="info"><span class="categorie">Synopsis :</span></p><p class="info"> Résumé du film </p>';
		}
	}
	else
	{
		$Titre = '<p class="info"><span class="categorie">Titre :</span> Titre du film</p>' ;
		$Annee = '<p class="info"><span class="categorie">Année :</span> Année de sortie du film</p>';
		$plot  = '<p class="info"><span class="categorie">Synopsis :</span> Résumé du film</p>';
		$Genre = '<p class="info"><span class="categorie">Genre :</span> Genre du film</p>';
		$Realisateur = '<p class="info"><span class="categorie">Réalisateur :</span> Nom du Réalisateur principal</p>';
	}
	echo $Titre;
	echo $Genre;
	echo $Realisateur;
	echo $Annee;
	echo $plot;
}

 ?>
